export const showNav = function ({ dispatch, state }) {
  dispatch('SHOWNAV', !state.navShow)
}
export const addRoom = function ({ dispatch }, platform, roomId, fn) {
  dispatch('ADDROOM', platform, roomId, fn)
}
export const removeRoom = function ({ dispatch }) {
  dispatch('REMOVEROOM')
  dispatch('SHOWDELROOMCONFIRM', false, -1, '', '0')
}
export const cancelDelConfrim = function ({ dispatch }) {
  dispatch('SHOWDELROOMCONFIRM', false, -1, '', '0')
}
export const showDelRoomConfirm = function ({ dispatch }, index, platform, roomId) {
  dispatch('SHOWDELROOMCONFIRM', true, index, platform, roomId)
}
export const showMsg = function ({ dispatch, state }, key) {
  dispatch('SHOWMSG', key)
  dispatch('INITMSGS')
}
export const showRank = function ({ dispatch, state }, key) {
  dispatch('SHOWRANK', key)
  if (state.rightDrawer.showRank) {
    dispatch('INITGIFT', key.indexOf('dy') > -1 ? 'dy' : 'panda')
    dispatch('GETRANK', 'msgs')
  }
}
export const showChart = function ({ dispatch, state }, key) {
  dispatch('SHOWCHART', key)
}
export const showGift = function ({ dispatch }, key) {
  dispatch('SHOWGIFT', key)
  dispatch('INITGIFTS', key)
}
export const closeRightDrawer = function ({ dispatch }) {
  dispatch('RIGHTDRAWERCLOSE')
}
export const bindMsgEl = function ({ dispatch }, el) {
  dispatch('BINDMSGS', el)
}
export const bindGiftEl = function ({ dispatch }, el) {
  dispatch('BINDMGIFT', el)
}
export const getRank = function ({ dispatch }, field) {
  dispatch('GETRANK', field)
}
export const getRoomList = function ({ dispatch }) {
  dispatch('GETROOMS')
}
export const getHistoryRooms = function ({dispatch}) {
  dispatch('GETHISTORYROOM')
}
export const removeHistoryRoom = function ({dispatch}, key, index) {
  dispatch('REMOVEHISTORYROOM', key, index)
}

